package de.hft_stuttgart.dsa.ctt.model;

import java.util.List;

/**
 * This matrix is basically used within the Assignment process of courses.
 * 
 * @author Eduard Tudenhoefner
 */
public class CourseAssignmentMatrix extends AbstractMatrix {

	public CourseAssignmentMatrix(List<Room> rooms, List<Period> periods) {
		super(rooms, periods);

		if (null != rooms && null != periods) {
			periodRoomMatrix = new Course[periods.size()][rooms.size()];

			// matrix is initialized with default courses
			initializeMatrix();
		} else {
			throw new RuntimeException("Rooms or Periods must not be null");
		}
	}

	/**
	 * The matrix is initialized with default courses.
	 */
	private void initializeMatrix() {
		for (int i = 0; i < periodRoomMatrix.length; i++) {
			for (int j = 0; j < periodRoomMatrix[i].length; j++) {
				periodRoomMatrix[i][j] = new Course();
			}
		}
	}

}
